/**
 * 
 * @authors Your Name (you@example.org)
 * @date    2018-11-23 10:39:30
 * @version $Id$
 */

var $ = jquery = layui.jquery;
var layer = layui.layer;
var upload = layui.upload;



//图片上传
var uploadInst = upload.render({
	elem: '#upImgBtn',
	url: '/Manage/SysAjax/imgUpload',
	before: function(obj) {
		obj.preview(function(index, file, result) {
			$('#view').attr('src', result); //图片链接（base64）
		});
	},
	done: function(res) {
		//如果上传失败
		if (res.type == "success") {
			return layer.msg('上传成功');
		} else {
			return layer.msg('上传失败');
		}
		//上传成功
	},
	error: function() {
		return layer.msg('上传失败');
	}
});
//文件上传
upload.render({
	elem: '#upFileBtn',
	url: '/Manage/SysAjax/rsUpload',
	accept: 'file',
	exts: 'EPUB',
	done: function(res) {
		console.log(res)
	}
});



//        form.on('submit()', function(data){

//   console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
//   alert("提交表单");
//   return false; 
// });